#include "user_print.h"
#include"FreeRTOS.h"
#include"task.h"
#define GPIOA *((volatile unsigned int*)0x10000000)
#define UART_DR *((volatile unsigned char*)0x00001000)

#define SECTION(x)                  __attribute__((section(x)))


const char hextable[]={'0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'};
extern void xPortSysTickHandler( void );
void  irq(unsigned int irq,unsigned int *p) 
{

    if((irq&0x20000000)==0x20000000)
    {
        user_printf("error inst 0x%08x\r\n",*(p--));
        user_printf("addr 0x%08x\r\n",p--);
        while(1);
    }
    else if((irq&0x10000000)==0x10000000)
    {
        xPortSysTickHandler();//系统心跳
    }
    user_printf("irq:0x%08x\r\n",irq);
    putstring("irq1\r\n");

}
void haha()
{
    putstring("hentai hello world python java C android\r\n");
    while(1);
}
extern void set_reg(unsigned int i);
extern unsigned int get_reg(void);
extern void set_irq(unsigned int i);
void printInt(unsigned int p)
{
    user_printf("pxTopOfStack 0x%08x\r\n",p);

}
void task1(void *str)
{
  for(;;)
  {
    putstring("task1\r\n");
    vTaskDelay(1);

  }
}
void task2(void *str)
{
  for(;;)
  {
    putstring("task2\r\n");
    vTaskDelay(1);

  }
}

int main(void)
{

unsigned int i=0;
set_reg(10000);


i^=0xff;

i^=0xff;

GPIOA=0;
GPIOA = 3;
set_irq(0x0fffffff);
xTaskCreate(task1,"task1",1024,NULL,4,NULL);
xTaskCreate(task2,"task2",2048,NULL,3,NULL);

vTaskStartScheduler();
    while(1)
    {
        GPIOA^=0xff;

//        GPIO0=~GPIO0;
    }
    return 0;
}